<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>天天生鲜-提交订单</title>
	<link rel="stylesheet" type="text/css" href="/static/client/css/reset.css">
	<link rel="stylesheet" type="text/css" href="/static/client/css/main.css">
</head>
<body>
<div th:replace="~{/comm/header_con}" />

<div th:replace="~{/comm/search_bar}" />
	<form id="detail" onsubmit="return false">
	<h3 class="common_title">确认收货地址</h3>

	<div th:if="${fAddress}" class="common_list_con clearfix">
		<dl>
			<dt>寄送到：</dt>
			<dd><input type="radio" name="" checked=""><th:block th:text="|${fAddress.address}  (${fAddress.userName} 收)  ${fAddress.phone}|"></th:block></dd>
		</dl>
		<a href="/user_center_site" class="edit_site">编辑收货地址</a>
	</div>
	<div th:unless="${fAddress}" class="common_list_con clearfix">
		<dl><dt>您还未设置收货地址</dt></dl>
		<a href="/user_center_site" class="edit_site">编辑收货地址</a>
	</div>
	<h3 class="common_title">支付方式</h3>
	<div class="common_list_con clearfix">
		<div class="pay_style_con clearfix">
			<input type="radio" name="payStatus" checked>
			<label class="cash">货到付款</label>
			<input type="radio" name="payStatus">
			<label class="weixin">微信支付</label>
			<input type="radio" name="payStatus">
			<label class="zhifubao"></label>
			<input type="radio" name="payStatus">
			<label class="bank">银行卡支付</label>
		</div>
	</div>

	<h3 class="common_title">商品列表</h3>

	<div class="common_list_con clearfix">
		<ul class="goods_list_th clearfix">
			<li class="col01">商品名称</li>
			<li class="col02">商品单位</li>
			<li class="col03">商品价格</li>
			<li class="col04">数量</li>
			<li class="col05">小计</li>
		</ul>
		<ul th:each="good,goodStat:${cart.getGoods()}" class="goods_list_td clearfix">
			<li class="col01">1</li>
			<li class="col02"><img th:src="${good.imgUrl}"></li>
			<li class="col03" th:text="${good.goodName}"></li>
			<li class="col04" th:text="|${cart.num}${good.unit}|"></li>
			<li class="col05" th:text="|${good.price}元|"></li>
			<li class="col06" th:text="${good.num}"></li>
			<li class="col07" th:text="|${good.totalPrice}元|"></li>
		</ul>
<!--		<ul class="goods_list_td clearfix">-->
<!--			<li class="col01">2</li>-->
<!--			<li class="col02"><img src="images/goods/goods003.jpg"></li>-->
<!--			<li class="col03">大兴大棚草莓</li>-->
<!--			<li class="col04">500g</li>-->
<!--			<li class="col05">16.80元</li>-->
<!--			<li class="col06">1</li>-->
<!--			<li class="col07">16.80元</li>-->
<!--		</ul>-->
	</div>

	<h3 class="common_title">总金额结算</h3>

	<div class="common_list_con clearfix">
		<div class="settle_con">
			<div class="total_goods_count">共<em th:text="|${cart.num}件商品，总金额|"></em><b th:text="|${totalPrice}元|"></b></div>
			<div class="transit">运费：<b>10元</b></div>
			<div class="total_pay">实付款：<b th:text="|${totalPrice}元|"></b></div>
		</div>
	</div>

	<div class="order_submit clearfix">
<!--		<a href="javascript:;" id="order_btn">提交订单</a>-->
		<input type="submit"  id="order_btn"  value="提交订单">
	</div>
	</form>
<div th:replace="~{/comm/footer}" />

	<div class="popup_con">
		<div class="popup">
			<p>订单提交成功！</p>
		</div>

		<div class="mask"></div>
	</div>
	<script type="text/javascript" src="/static/common/js/jquery.min.js"></script>
	<script type="text/javascript">
		$('#order_btn').click(function() {
			$.ajax({
				type: "POST",
				url:"/fOrder/save",
				data:$('#detail').serialize(),// 序列化表单值
				async: false,
				error: function(request) {
					alert("程序出错，请联系管理员");
				},
				success: function(data) {
					if (data.code===200){
						localStorage.setItem('order_finish',2);
						// alert("商品已加入购物车！");
						$('.popup_con').fadeIn('fast', function() {
							setTimeout(function(){
								$('.popup_con').fadeOut('fast',function(){
									window.location.href = '/user_center_order';
								});
							},3000)
						});
					}else {
						window.location.href = data.message;
						// alert(data.message);
					}
				}
			});
		});
	</script>
</body>
</html>
